<%@ page language="java" import="java.util.*, java.text.*,java.sql.Timestamp,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.zxlb.manager.*, com.zjut.zs.zxlb.dao.*,
com.zjut.zs.hjqk.manager.*, com.zjut.zs.hjqk.dao.*,com.zjut.zs.shhd.manager.*, com.zjut.zs.shhd.dao.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.file.manager.*, com.zjut.zs.file.dao.*,
com.zjut.zs.file.manager.*, com.zjut.zs.file.dao.*,
com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*" pageEncoding="utf-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <link href="../plugins/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="../plugins/assets/css/custom.css" rel="stylesheet" type="text/css"/>

    <link rel="stylesheet" href="../plugins/imgrotate/css/index.css">
<title><%=Config.webname%></title>

    
</head>
<%	
if (session.getAttribute("admin") == null&&session.getAttribute("user") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {
ZsUserStatusManager manager = (ZsUserStatusManager)SpringContextUtil.getBean("ZsUserStatusManager");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager usmanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
ZsFileManager fmanager = (ZsFileManager) SpringContextUtil.getBean("ZsFileManager");
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsZxlbManager xmanager = (ZsZxlbManager) SpringContextUtil.getBean("ZsZxlbManager");
ZsHjqkManager hmanager = (ZsHjqkManager) SpringContextUtil.getBean("ZsHjqkManager");
ZsShhdManager smanager = (ZsShhdManager) SpringContextUtil.getBean("ZsShhdManager");

ZsFile file = new ZsFile();
String usId = request.getParameter("usId");
ZsUser user = umanager.getData(usId);
ZsUserStatus userstatus = usmanager.getDataByUser(user);
String filelocalview = anconfig.getSingleConfigInfoByName("材料本地浏览");
%>
<body class="page-header-fixed">

	
<a class="btn btn-default btn-xs btn-success" data-toggle="modal" href="#tagresponsive">设置标签</a>
	
<ul class="picView-magnify-list" style="padding: 30px">
<%
//String fiType = request.getParameter("fiType");
//if ("sbcl".equals(fiType)) {
	List flist = new ArrayList();
	List cfnlist = anconfig.getConfigsInfoByClass("上传材料名称(必需)");
	for (int i=0; i<cfnlist.size(); i++){
	 	AnConfig fn = (AnConfig)cfnlist.get(i);
		String fiName = fn.getCoValue();
		file.setZsUser(user);
		file.setFiName(fiName);	
		file.setFiType("sbcl");
		flist = fmanager.getDataByInstance(1,100,"fiId","asc",file).getObjects();
		if (flist.size()>0) {
			for (int k = 0; k < flist.size(); k++) { 
				ZsFile fi = (ZsFile)flist.get(k);	
				String fileName = "[申请材料]"+fiName+"材料"+(k+1);	   
			%>
	    <li>
	    	<i><%=fileName %></i>
	        <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>" data-caption="<%=fileName %>">
	            <img src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>">
	        </a>
	    </li>
			<%}
		}
	}	
	List cfnlist2 = anconfig.getConfigsInfoByClass("上传材料名称(可选)");
	for (int i=0; i<cfnlist2.size(); i++){
	 	AnConfig fn = (AnConfig)cfnlist2.get(i);
		String fiName = fn.getCoValue();
		file.setZsUser(user);
		file.setFiName(fiName);	
		file.setFiType("sbcl");
		flist = fmanager.getDataByInstance(1,100,"fiId","asc",file).getObjects();
		if (flist.size()>0) {
			for (int k = 0; k < flist.size(); k++) { 
				ZsFile fi = (ZsFile)flist.get(k);	
				String fileName = "[申请材料]"+fiName+"材料"+(k+1);	   
			%>
	    <li>
	    	<i><%=fileName %></i>
	        <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>" data-caption="<%=fileName %>">
	            <img src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>">
	        </a>
	    </li>
			<%}
		}
	}
	flist = fmanager.getOtherFiles(user.getUsId(),"sbcl");
	if (flist.size()>0) {
		for (int k = 0; k < flist.size(); k++) { 
			ZsFile fi = (ZsFile)flist.get(k);	
			String fileName = "[申请材料]"+"其他材料"+(k+1);	   
		%>
		<li>
			<i><%=fileName %></i>
		    <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>" data-caption="<%=fileName %>">
		        <img src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>">
		    </a>
		</li>
		<%}
	}
//} else if ("zxlb".equals(fiType)){
	ZsZxlb zxlb = new ZsZxlb();
	zxlb.setZsUser(user);
	List list = xmanager.getDataByInstance(1,100,null,null,zxlb).getObjects();
	for (int i=0; i<list.size(); i++) {
		zxlb = (ZsZxlb)list.get(i);
		file.setZsUser(user);
		System.out.println("#################################################### " + zxlb.getZxId());
		file.setFiName(String.valueOf(zxlb.getZxId()));
		file.setFiType("zxlb");
		flist = fmanager.getDataByInstance(1,100,"fiName","asc",file).getObjects();
		if (flist.size()>0) {
			for (int k = 0; k < flist.size(); k++) { 
				ZsFile fi = (ZsFile)flist.get(k);	
				String fileName = "[专项类别]"+zxlb.getZxName()+"材料"+(k+1);	   
			%>
	    <li>
	    	<i><%=fileName %></i>
	        <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>" data-caption="<%=fileName %>">
	            <img src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>">
	        </a>
	    </li>
			<%}
		}
	}
//} else if ("hjqk".equals(fiType)){
	ZsHjqk hjqk = new ZsHjqk();
	hjqk.setZsUser(user);
	list = hmanager.getDataByInstance(1,100,null,null,hjqk).getObjects();
	for (int i=0; i<list.size(); i++) {
		hjqk = (ZsHjqk)list.get(i);
		file.setZsUser(user);
		file.setFiName(String.valueOf(hjqk.getHjId()));
		file.setFiType("hjqk");
		flist = fmanager.getDataByInstance(1,100,"fiName","asc",file).getObjects();
		if (flist.size()>0) {
			for (int k = 0; k < flist.size(); k++) { 
				ZsFile fi = (ZsFile)flist.get(k);	
				String fileName = "[其他获奖]"+hjqk.getHjName()+"材料"+(k+1);	   
			%>
	    <li>
	    	<i><%=fileName %></i>
	        <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>" data-caption="<%=fileName %>">
	            <img src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>">
	        </a>
	    </li>
			<%}
		}
	}
//} else if ("shhd".equals(fiType)){
	ZsShhd shhd = new ZsShhd();
	shhd.setZsUser(user);
	list = smanager.getDataByInstance(1,100,null,null,shhd).getObjects();
	for (int i=0; i<list.size(); i++) {
		shhd = (ZsShhd)list.get(i);
		file.setZsUser(user);
		file.setFiName(String.valueOf(shhd.getHdId()));
		file.setFiType("shhd");
		flist = fmanager.getDataByInstance(1,100,"fiName","asc",file).getObjects();
		if (flist.size()>0) {
			for (int k = 0; k < flist.size(); k++) { 
				ZsFile fi = (ZsFile)flist.get(k);	
				String fileName = "[社会活动]"+shhd.getHdName()+"材料"+(k+1);	   
			%>
	    <li>
	    	<i><%=fileName %></i>
	        <a href="javascript:void(0)" data-magnify="gallery" data-group="g1" data-src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>" data-caption="<%=fileName %>">
	            <img src="<%=fmanager.getFileURL(filelocalview, fi.getFiFile(), user.getUsIdcard(), false) %>">
	        </a>
	    </li>
			<%}
		}
	}
//} 
%>
 
</ul>


<!-- /.modal 标签选择-->
<div id="tagresponsive" class="modal fade" tabindex="-1" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
				<h4 class="modal-title">选择标签</h4>
			</div>
			<div class="modal-body">
				<div class="scroller" style="height:200px" data-always-visible="1" data-rail-visible1="1">
					<div class="row">
						<div class="col-md-9">
							<div class="radio-list">
							<%
							List fnlist = anconfig.getConfigsInfoByClass("标签配置");
							for (int i=0; i<fnlist.size(); i++){
						    	AnConfig fn = (AnConfig)fnlist.get(i);
						    	String tag = fn.getCoValue();
							 %>							 
								<label>
								<input type="radio" name="tag" id="tag" value="<%=tag %>" checked> 
								<%=tag%>
								</label>						 
							<%} %>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" data-dismiss="modal" class="btn default">取消</button>
				<button type="button" class="btn green" onclick="tagSelections();">保存设置</button>
			</div>
		</div>
	</div>
</div>
<div class="modal fade" id="ajax" tabindex="-1" role="basic" aria-hidden="true">
	<img src="assets/img/ajax-modal-loading.gif" alt="" class="loading">
</div>
<!-- /.modal -->	
<script src="../plugins/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>    
<script src="../plugins/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
<script src="../plugins/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
<script src="../plugins/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>

	
<script src="../plugins/imgrotate/js/index.js"></script>
<script src="../plugins/imgrotate/js/jquery.rotate.min.js"></script>
	<!-- BEGIN PAGE LEVEL PLUGINS -->
	<script src="../plugins/assets/plugins/bootbox/bootbox.min.js" type="text/javascript" ></script>
	<!-- END PAGE LEVEL PLUGINS -->
<script type="text/javascript">
    $(function () {
        $('[data-magnify]').Magnify({
            Toolbar: [
                'prev',
                'next',
                'rotateLeft',
                'rotateRight',
                'zoomIn',
                'actualSize',
                'zoomOut'
            ],
            keyboard:true,
            draggable:true,
            movable:true,
            modalSize:[1000,800],
            beforeOpen:function (obj,data) {
                console.log('beforeOpen')
            },
            opened:function (obj,data) {
                console.log('opened')
            },
            beforeClose:function (obj,data) {
                console.log('beforeClose')
            },
            closed:function (obj,data) {
                console.log('closed')
            },
            beforeChange:function (obj,data) {
                console.log('beforeChange')
            },
            changed:function (obj,data) {
                console.log('changed')
            }
        });

    })
    

    
		function tagSelections(){
			var tag = $('input[name="tag"]:checked').val();
			if (confirm("是否确认"))  {  
				$.post("../zsUserStatusTag.action?tagStatusType=single&ussId=<%=userstatus.getUssId()%>&tag="+tag,{},function(data){
					if(data.flag=="success"){
						alert("修改成功！");
						location.reload();
					}else{
						alert("修改失败！");
					}
				});
			}
		}
</script>
</body>
<%} %>
</html>